﻿using com.nm.Attributes;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BaseAPI.model
{
    public class RoleData
    {
        /// <summary>
        /// 角色下的用户列表，模块信息
        /// </summary>
        public class RoleUserModuleBtn
        {
            public IList<UserList> userList { get; set; }

            public IList<ModuleBtnList> moduleList { get; set; }
        }

        public class ModuleBtnList : ModuleData
        {
            public IList<ModifyBtnData> btnList { get; set; }
        }

        /// <summary>
        /// 角色下所有用户
        /// </summary>
        public class UserList
        {
            [ParamDescription("用户ID")]
            public int UsersID { get; set; }

            [ParamDescription("用户名")]
            public string UserName { get; set; }

            [ParamDescription("性别")]
            public bool Sex { get; set; }
        }

        /// <summary>
        /// 角色下所有模块
        /// </summary>
        public class ModuleList
        {
            [ParamDescription("模块编码")]
            public string ModuleCode { get; set; }

            [ParamDescription("模块名称")]
            public string ModuleName { get; set; }
        }

        public class ButtonList
        {
            [ParamDescription("按钮名称")]
            public string BtnName { get; set; }
        }

        /// <summary>
        /// 设置角色用户
        /// </summary>
        public class InitRoleData
        {
            [ParamDescription("角色用户集合")]
            public IList<SingleRoleData> list { get; set; }
        }

        [Description("单个角色数据")]
        public class SingleRoleData
        {

            [ParamDescription("角色ID")]
            public int RoleID { get; set; }

            [ParamDescription("用户ID")]
            public IList<int> UsersID { get; set; }
        }


        /// <summary>
        /// 设置角模块权限
        /// </summary>
        public class InitRoleModuleData
        {
            [ParamDescription("角色ID")]
            public int RoleID { get; set; }

            [ParamDescription("角色模块集合")]
            public IList<SingleRoleModuleData> list { get; set; }
        }

        [Description("单个模块权限数据")]
        public class SingleRoleModuleData
        {
            [ParamDescription("角色ID")]
            public int ModuleID { get; set; }

            [ParamDescription("按钮ID")]
            public IList<int> BtnID { get; set; }
        }

        /// <summary>
        /// 明细
        /// </summary>
        public class DetailData : ListData
        {
            public IList<UserList> RoleUserList { get; set; }
            public IList<ModuleList> RoleModuleList { get; set; }
            public IList<ButtonList> RoleBtnList { get; set; }

        }
        /// <summary>
        /// 列表
        /// </summary>
        public class ListData : ModifyData
        {
            [ParamDescription("角色拥有用户数")]
            public int UserCount { get; set; }

            [ParamDescription("所属部门")]
            public string DeptName { get; set; }
        }

        public class ModifyData : CreateData
        {
            [ParamDescription("角色ID")]
            public int ID { get; set; }
        }

        public class CreateData
        {
            [ParamDescription("角色名称")]
            public string RoleName { get; set; }

            [ParamDescription("角色类型1-系统角色;2-业务角色")]
            public int RoleType { get; set; }

            [ParamDescription("显示顺序")]
            public int Sort { get; set; }

            [ParamDescription("是否有效")]
            public bool IsEffective { get; set; }

            [JsonProperty(NullValueHandling = NullValueHandling.Include)]
            [ParamDescription("备注")]
            public string Memo { get; set; }

            [ParamDescription("部门ID")]
            public int DeptID { get; set; }

        }
    }
}
